package com.vibration.matlab;

import com.mathworks.toolbox.javabuilder.MWClassID;
import com.mathworks.toolbox.javabuilder.MWException;
import com.mathworks.toolbox.javabuilder.MWNumericArray;
import getC.GetCParameters;

/**
 * 得到C的数据
 */
public class GetC {

    /**
     * 得到C的数据
     * 得到输出
     * function [HVFobs,HVAobs,nmHV,nmDC,HVDS,pass]=LoadC(HVC)
     */
    public static TransInfo getCData(C c,double[][] HVC,double Vstd) throws MWException {

        TransInfo transInfo=new TransInfo();
        MWNumericArray matArr = new MWNumericArray(HVC, MWClassID.DOUBLE);
        MWNumericArray matVstd = new MWNumericArray(Vstd, MWClassID.DOUBLE);
        GetCParameters getCParameters=new GetCParameters();
        Object[] response=getCParameters.getC(6,matArr,matVstd);
        //解析存储数据
        /**
         * 得到HVFobs
         */
        MWNumericArray getHVFobs=(MWNumericArray)response[0];
        double[][] HVFobs=(double[][])getHVFobs.toDoubleArray();
        c.setHVFobs(HVFobs);
        /**
         * 得到HVAobs
         */
        MWNumericArray getHVAobs=(MWNumericArray)response[1];
        double[][] HVAobs=(double[][])getHVAobs.toDoubleArray();
        c.setHVAobs(HVAobs);
        /**
         * 得到nmHV
         */
        MWNumericArray getnmHV=(MWNumericArray)response[2];
        double[][] nmHV=(double[][])getnmHV.toDoubleArray();
        c.setNmHV(nmHV);
        /**
         * 得到nmDC
         */
        MWNumericArray getnmDC=(MWNumericArray)response[3];
        double[][] nmDC=(double[][])getnmDC.toDoubleArray();
        c.setNmDC(nmDC);

        MWNumericArray getHVDS=(MWNumericArray)response[4];
        double[][] HVDS=(double[][])getHVDS.toDoubleArray();
        c.setHVDS(HVDS);

        transInfo.setC(c);
        return transInfo;
    }
}
